package api

import (
	"github.com/gin-gonic/gin"
	"zg3/user-modules/api/handler"
	"zg3/user-modules/pkg"
)

func LoadRouter(r *gin.Engine) {

	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/login", handler.UserLogin)
			user.POST("/list", handler.UserList)

			user.Use(pkg.JWTAuth("2210a"))
			user.POST("/send-friend-req", handler.SendFriendReq)
			user.POST("/audit-friend-req", handler.AuditFriendReq)
			user.POST("/remove-friend", handler.RemoveFriend)

		}
		chat := api.Group("/chat")
		{
			chat.Use(pkg.JWTAuth("2210a"))
			chat.GET("/ws", handler.WebsocketChat)
			chat.POST("/find-chat", handler.FindChat)
		}
	}
}
